home *** CD-ROM | disk | FTP | other *** search
- /* file: EasyGrabberTest.c
- *
- * Started 18 December 1991
- *
- * An example of the simplest
- * interface to a video digitizer.
- *
- */
-
-
- /*--------------------------
- Inclusions
- --------------------------*/
-
- /*
- * There's a lot, because we
- * need to INIT all the managers.
- */
-
- #include <QuickDraw.h>
- #include <Events.h>
- #include <Menus.h>
- #include <ToolUtils.h>
- #include <Menus.h>
- #include <Windows.h>
- #include <Memory.h>
- #include <Fonts.h>
- #include <OSEvents.h>
-
- #include <Movies.h>
-
- #include "BigEasyVideoGrabber.h"
-
-
- /*--------------------------
- Local Prototypes
- --------------------------*/
-
- static void InitToolbox(void);
- static void DigitizeInAWindow(void);
-
- void main(void);
-
- /*--------------------------
- The Computer Program
- --------------------------*/
-
- void InitToolbox(void)
- {
- InitGraf(&qd.thePort);
- InitFonts();
- FlushEvents(0xffff,0);
- InitWindows();
- InitMenus();
- InitCursor();
-
- EnterMovies();
- }
-
- void DigitizeInAWindow(void)
- {
- WindowPtr w;
- Rect r;
- short i;
- Boolean gotAFrame;
-
- SetRect(&r,100,100,260,220); /* 160 x 120 window */
-
- w = NewCWindow(0,&r,"\pFive Clicks",true,
- noGrowDocProc,
- (WindowPtr)-1,0,0);
-
- SetPort(w);
-
- /*
- * Set the rectangle we'll be drawing into.
- */
- SetRect(&r,0,0,160,120);
-
- /*
- * Let the user click five times
- * and grab a frame each time.
- *
- * This is a substandard user interface,
- * I am sure you will agree.
- */
- for(i = 0; i < 5; i++)
- {
- /*
- * Wait For A MouseClick
- */
- while(!Button());
- while(Button());
-
- /*
- * Grab a frame, allocate and deallocate on the fly.
- */
- gotAFrame = GrabEasyVideoGrabber(nil,&r);
-
- /*
- * If we didn't get a frame, just quit and go home.
- */
- if(!gotAFrame)
- return;
- }
- }
-
- void main(void)
- {
- InitToolbox();
- DigitizeInAWindow();
- FlushEvents(0xffff,0);
- }
-
-
-